var ligerGrid;

$(function() {
			var options = {
				queryKey : queryKey,
				pageSize : 30,
				gridWidth : null,
				gridHeight : 580,
				showIdx : false,
				// init param for groove.query, property querykey is reserved,
				// property method is reserved,
				params : {
					supid : pkid
				},
				// init param for groove.view, property id is reserved
				viewParams : {
					pkid : pkid
				},
				gridRender : function(grid) {
					ligerGrid = grid;
				}
			};
			var gridPanel = new $.grooveQuery(options);

			$("#pageloading").hide();
		});

function defaultFnRender(rowdata, rowindex, value, column) {
	if (column.name == "FP_LOANRATE") {
		return formatDate(value);
	} else if (column.name == "SP") {
		return "<a href=\"javascript:void(0);\" onclick=\"applyloan('"
				+ rowdata["PK_ID"] + "', '" + rowdata["FP_NAME"]
				+ "')\">申请贷款</a>";
	}
	return value;
}

function applyloan(id, name) {
	$("#pageloading").show();
	var editDialog = $.ligerDialog.open({
				title : "请选择用于贷款申请的订单",
				target : $("#fcorderlist4loan"),
				height : 570,
				width : 800,
				isResize : true,
				buttons : [{
					text : '确定',
					onclick : function(item, dialog) {
						var ligerGrid = $("#fcorderlist4loan")
								.ligerGetGridManager();
						var records = ligerGrid.selected;
						if (records.length > 0) {
							document.location = context
									+ "/site/companySupplier/7-1.jsp?id=" + id
									+ "&indentID=" + records[0]["ID_ID"];

						} else {
							$.ligerDialog.warn("请选择订单");
						}

					}
				}, {
					text : '关闭',
					onclick : function(item, dialog) {
						dialog.hide();
					}
				}]
			});

	var options = {
		queryKey : "fcorderlist4loan",
		pageSize : 30,
		gridWidth : 770,
		gridHeight : 500,
		showIdx : false,
		params : {

		},
		gridRender : function(grid) {

		}
	};
	var gridPanel = new $.grooveQuery(options);

	$("#pageloading").hide();
}